<?php
/**
 * File containing the NomDomaine class.
 */
/**
 * NomDomaine
 *
 * @property string $agresso
 * @property string $commentaire
 * @property int $dateHebergement
 * @property string $domaine
 * @property string $email
 * @property int $expiration
 * @property string $facturation
 * @property string $hebergement
 * @property int $id
 * @property bool $mailEnvoye
 * @property string $nomClient
 * @property string $societe
 * @property bool $supprime
 * @property string $tel
 */
class NomDomaine implements ezcPersistentObject
{
	/***
	 * Properties.
	 *
	 * @var array(string=>mixed)
	 */
	protected $properties = array();

	/**
	 * Creates a new NomDomaine
	 *
	 * @return void
	 */
	public function __construct()
	{

		$this->properties['agresso'] = null;

		$this->properties['commentaire'] = null;

		$this->properties['dateHebergement'] = null;

		$this->properties['domaine'] = null;

		$this->properties['email'] = null;

		$this->properties['expiration'] = null;

		$this->properties['facturation'] = null;

		$this->properties['hebergement'] = null;

		$this->properties['id'] = null;

		$this->properties['mailEnvoye'] = false;

		$this->properties['nomClient'] = null;

		$this->properties['societe'] = null;

		$this->properties['supprime'] = false;

		$this->properties['tel'] = null;
	}

	/**
	 * Set properties after reading an object from the database.
	 *
	 * @param array(string=>mixed) $properties
	 * @return void
	 *
	 * @access private
	 */
	public function setState( array $properties )
	{
		foreach ( $properties as $name => $value )
		{
			$this->properties[$name] = $value;
		}
	}

	/**
	 * Returns the property values to store an object to the database.
	 *
	 * @return array(string=>mixed)
	 *
	 * @access private
	 */
	public function getState()
	{
		return $this->properties;
	}

	/**
	 * Overloading to set properties.
	 *
	 * @throws ezcBaseValueException
	 *         if the property value to set does no conform to type constraints.
	 * @throws ezcBasePropertyNotFoundException
	 *         if the desired property does not exist.
	 *
	 * @param string $propertyName
	 * @param mixed $propertyValue
	 * @return void
	 *
	 * @ignore
	 */
	public function __set( $propertyName, $propertyValue )
	{
		switch ( $propertyName )
		{

			case 'agresso':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'commentaire':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'dateHebergement':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'domaine':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'email':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'expiration':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'facturation':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'hebergement':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'id':
				if ( !is_int( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'int'
						);
				}
				break;

			case 'mailEnvoye':
				if ( !is_bool( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'bool'
						);
				}
				break;

			case 'nomClient':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'societe':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			case 'supprime':
				if ( !is_bool( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'bool'
						);
				}
				break;

			case 'tel':
				if ( !is_string( $propertyValue ) )
				{
					throw new ezcBaseValueException(
					$propertyName,
					$propertyValue,
						'string'
						);
				}
				break;

			default:
				throw new ezcBasePropertyNotFoundException(
				$propertyName,
				$propertyValue
				);
		}
		$this->properties[$propertyName] = $propertyValue;
	}

	/**
	 * Overloading to get properties.
	 *
	 * @throws ezcBasePropertyNotFoundException
	 *         if the desired property does not exist.
	 *
	 * @param string $propertyName
	 * @return void
	 *
	 * @ignore
	 */
	public function __get( $propertyName )
	{
		if ( $this->__isset( $propertyName ) )
		{
			switch ( $propertyName )
			{
	
				case 'dateHebergement':
				case 'expiration':
					return HelperDate::dateMysqlToFr($this->properties[$propertyName]);
					break;
					
				default:
					return $this->properties[$propertyName];
			}
			
		}
		throw new ezcBasePropertyNotFoundException( $propertyName );
	}

	/**
	 * Overloading for property isset() checks.
	 *
	 * @param string $propertyName
	 * @return bool
	 *
	 * @ignore
	 */
	public function __isset( $propertyName )
	{
		return array_key_exists( $propertyName, $this->properties );
	}
}

?>
